/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package centralehotel.modele;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mathieu
 */
@Entity
@Table(name = "pays")
@NamedQueries({@NamedQuery(name = "Pays.findByCodePays", query = "SELECT p FROM Pays p WHERE p.codePays = :codePays"), @NamedQuery(name = "Pays.findByLibellePays", query = "SELECT p FROM Pays p WHERE p.libellePays = :libellePays")})
public class Pays implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "code_pays", nullable = false)
    private String codePays;
    @Column(name = "libelle_pays")
    private String libellePays;
    @OneToMany(mappedBy = "pays")
    private Collection<Ville> villeCollection;

    public Pays() {
    }

    public Pays(String codePays) {
        this.codePays = codePays;
    }

    public String getCodePays() {
        return codePays;
    }

    public void setCodePays(String codePays) {
        this.codePays = codePays;
    }

    public String getLibellePays() {
        return libellePays;
    }

    public void setLibellePays(String libellePays) {
        this.libellePays = libellePays;
    }

    public Collection<Ville> getVilleCollection() {
        return villeCollection;
    }

    public void setVilleCollection(Collection<Ville> villeCollection) {
        this.villeCollection = villeCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codePays != null ? codePays.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pays)) {
            return false;
        }
        Pays other = (Pays) object;
        if ((this.codePays == null && other.codePays != null) || (this.codePays != null && !this.codePays.equals(other.codePays))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "centralehotel.exception.Pays[codePays=" + codePays + "]";
    }

}
